<?php
     class userModel extends Model{
	    //用户的模型
	    //获取全部用户信息
	    public function getAll(){
		  $sql="select * from user";
		  $rs=$this->db->fetchAll($sql);
		  return $rs;
		}
		//删除用户
		public function delete(){
			$id=$_GET['id'];
			$sql="DELETE FROM `user` WHERE `user`.`id` = '{$id}'";
			$rs=$this->db->query($sql);
			return $rs;
		}
		//查看用户信息
		public function data(){
			$id=$_GET['id'];
			$sql="select * from user where id='{$id}'";
			$rs=$this->db->fetchRow($sql);
			
			return $rs;
		}
		//返回用户名比对数据
		public function selectAll(){
			$textfield=$_POST['textfield'];
			$sql=$this->db->fetchRow("select * from user where username='{$textfield}'");
			return $sql;
	    }
	 } 
?>